Updates to work with GTK+-2.0 theme engine architecture. It won't even
authorOwen Taylor <otaylor@redhat.com>
Tue, 18 Jul 2000 16:21:33 +0000 (16:21 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 18 Jul 2000 16:21:33 +0000 (16:21 +0000)
Tue Jul 18 12:13:19 2000  Owen Taylor  <otaylor@redhat.com>

        Updates to work with GTK+-2.0 theme engine architecture.
It won't even sort of work with GTK+-1.2 any more.

* configure.in src/Makefile.am: Look for GTK+-2.0,
install engine into GTK+-2.0 location.

* src/pixbuf-style.h src/pixbuf-rc-style.[ch]: New
files for GtkRcStyle and GtkStyle subclasses. Parsing,
etc, moves to pixbuf-rc-style.[ch]

* src/pixbuf-draw.c: Chain up to parent implementation
when images aren't found for a certain element.

modules/engines/pixbuf/ChangeLog
modules/engines/pixbuf/Makefile.am
modules/engines/pixbuf/pixbuf-draw.c
modules/engines/pixbuf/pixbuf-main.c
modules/engines/pixbuf/pixbuf-rc-style.c [new file with mode: 0644]
modules/engines/pixbuf/pixbuf-rc-style.h [new file with mode: 0644]
modules/engines/pixbuf/pixbuf-style.h [new file with mode: 0644]
modules/engines/pixbuf/pixbuf.h

index cd5d93ced721dd58bcaf20bebef4532544a8cd4c..38a0b63ad45340768313e3f3ec9df07c0a3246ce 100644 (file)
@@ -1,3 +1,18 @@
+Tue Jul 18 12:13:19 2000  Owen Taylor  <otaylor@redhat.com>
+
+        Updates to work with GTK+-2.0 theme engine architecture.
+       It won't even sort of work with GTK+-1.2 any more.
+
+       * configure.in src/Makefile.am: Look for GTK+-2.0, 
+       install engine into GTK+-2.0 location.
+       
+       * src/pixbuf-style.h src/pixbuf-rc-style.[ch]: New
+       files for GtkRcStyle and GtkStyle subclasses. Parsing,
+       etc, moves to pixbuf-rc-style.[ch]
+
+       * src/pixbuf-draw.c: Chain up to parent implementation
+       when images aren't found for a certain element.
+
 Sun Jul  9 18:15:58 2000  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in (ACLOCAL): Add -Wall for gcc.
index 7169c0dd2953961351118acbf5a5d7ebb8470748..9d5449bea0f33f3daad1adad84d98b1c6ff19140 100644 (file)
@@ -1,6 +1,6 @@
 INCLUDES = $(GTK_CFLAGS)
 
-enginedir = $(libdir)/gtk/themes/engines
+enginedir = $(libdir)/gtk-2.0/$(GTK_VERSION)/engines
 
 engine_LTLIBRARIES = libpixmap.la
 
@@ -8,6 +8,9 @@ libpixmap_la_SOURCES =          \
        pixbuf-draw.c           \
        pixbuf-main.c           \
        pixbuf-render.c         \
+       pixbuf-rc-style.c       \
+       pixbuf-rc-style.h       \
+       pixbuf-style.h          \
        pixbuf.h
 
 libpixmap_la_LDFLAGS = -module -avoid-version
index bdcf4fc31ad762a96dfaebedfc8f5d226d6b6d3e..67c747f1cafa16d83c8d6a0b6f1751a8935f73f1 100644 (file)
 #include <string.h>
 
 #include "pixbuf.h"
+#include "pixbuf-rc-style.h"
+#include "pixbuf-style.h"
+
+static void pixbuf_style_init       (PixbufStyle      *style);
+static void pixbuf_style_class_init (PixbufStyleClass *klass);
+
+GtkStyleClass *parent_class;
 
 static ThemeImage *
-match_theme_image(GtkStyle       *style,
-                 ThemeMatchData *match_data)
+match_theme_image (GtkStyle       *style,
+                  ThemeMatchData *match_data)
 {
   GList *tmp_list;
 
-  tmp_list = ((ThemeData *)style->engine_data)->img_list;
+  tmp_list = PIXBUF_RC_STYLE (style->rc_style)->img_list;
   
   while (tmp_list)
     {
@@ -78,7 +85,7 @@ match_theme_image(GtkStyle       *style,
   return NULL;
 }
 
-static void
+static gboolean
 draw_simple_image(GtkStyle       *style,
                  GdkWindow      *window,
                  GdkRectangle   *area,
@@ -86,10 +93,10 @@ draw_simple_image(GtkStyle       *style,
                  ThemeMatchData *match_data,
                  gboolean        draw_center,
                  gboolean        allow_setbg,
-                 gint x,
-                 gint y,
-                 gint width,
-                 gint height)
+                 gint            x,
+                 gint            y,
+                 gint            width,
+                 gint            height)
 {
   ThemeImage *image;
   gboolean setbg = FALSE;
@@ -115,7 +122,7 @@ draw_simple_image(GtkStyle       *style,
        match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
     }
     
-  image = match_theme_image(style, match_data);
+  image = match_theme_image (style, match_data);
   if (image)
     {
       if (image->background)
@@ -123,7 +130,7 @@ draw_simple_image(GtkStyle       *style,
          GdkBitmap *mask = NULL;
 
          if (image->background->stretch && setbg &&
-             gdk_window_get_type (window) != GDK_WINDOW_PIXMAP)
+             !GDK_IS_PIXMAP (window))
            {
              GdkPixbuf *pixbuf = theme_pixbuf_get_pixbuf (image->background);
              if (pixbuf && gdk_pixbuf_get_has_alpha (pixbuf))
@@ -148,10 +155,14 @@ draw_simple_image(GtkStyle       *style,
                             window, NULL, area, COMPONENT_ALL,
                             TRUE, 
                             x, y, width, height);
+
+      return TRUE;
     }
+  else
+    return FALSE;
 }
 
-static void
+static gboolean
 draw_gap_image(GtkStyle       *style,
               GdkWindow      *window,
               GdkRectangle   *area,
@@ -192,7 +203,7 @@ draw_gap_image(GtkStyle       *style,
   match_data->flags |= THEME_MATCH_GAP_SIDE;
   match_data->gap_side = gap_side;
     
-  image = match_theme_image(style, match_data);
+  image = match_theme_image (style, match_data);
   if (image)
     {
       gint thickness;
@@ -212,7 +223,7 @@ draw_gap_image(GtkStyle       *style,
          if (pixbuf)
            thickness = gdk_pixbuf_get_height (pixbuf);
          else
-           thickness = style->klass->ythickness;
+           thickness = style->ythickness;
          
          if (!draw_center)
            components |= COMPONENT_NORTH_WEST | COMPONENT_NORTH | COMPONENT_NORTH_EAST;
@@ -235,7 +246,7 @@ draw_gap_image(GtkStyle       *style,
          if (pixbuf)
            thickness = gdk_pixbuf_get_height (pixbuf);
          else
-           thickness = style->klass->ythickness;
+           thickness = style->ythickness;
 
          if (!draw_center)
            components |= COMPONENT_SOUTH_WEST | COMPONENT_SOUTH | COMPONENT_SOUTH_EAST;
@@ -258,7 +269,7 @@ draw_gap_image(GtkStyle       *style,
          if (pixbuf)
            thickness = gdk_pixbuf_get_width (pixbuf);
          else
-           thickness = style->klass->xthickness;
+           thickness = style->xthickness;
 
          if (!draw_center)
            components |= COMPONENT_NORTH_WEST | COMPONENT_WEST | COMPONENT_SOUTH_WEST;
@@ -281,7 +292,7 @@ draw_gap_image(GtkStyle       *style,
          if (pixbuf)
            thickness = gdk_pixbuf_get_width (pixbuf);
          else
-           thickness = style->klass->xthickness;
+           thickness = style->xthickness;
 
          if (!draw_center)
            components |= COMPONENT_NORTH_EAST | COMPONENT_EAST | COMPONENT_SOUTH_EAST;
@@ -317,19 +328,23 @@ draw_gap_image(GtkStyle       *style,
        theme_pixbuf_render (image->gap_end,
                             window, NULL, area, COMPONENT_ALL, FALSE,
                             r3.x, r3.y, r3.width, r3.height);
+
+      return TRUE;
     }
+  else
+    return FALSE;
 }
 
 static void
-draw_hline(GtkStyle * style,
-          GdkWindow * window,
-          GtkStateType state,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          gint x1,
-          gint x2,
-          gint y)
+draw_hline (GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          x1,
+           gint          x2,
+           gint          y)
 {
   ThemeImage *image;
   ThemeMatchData   match_data;
@@ -338,12 +353,12 @@ draw_hline(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_HLINE;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
   match_data.state = state;
   match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
   
-  image = match_theme_image(style, &match_data);
+  image = match_theme_image (style, &match_data);
   if (image)
     {
       if (image->background)
@@ -351,18 +366,21 @@ draw_hline(GtkStyle * style,
                             window, NULL, area, COMPONENT_ALL, FALSE,
                             x1, y, (x2 - x1) + 1, 2);
     }
+  else
+    parent_class->draw_hline (style, window, state, area, widget, detail,
+                             x1, x2, y);
 }
 
 static void
-draw_vline(GtkStyle * style,
-          GdkWindow * window,
-          GtkStateType state,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          gint y1,
-          gint y2,
-          gint x)
+draw_vline (GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          y1,
+           gint          y2,
+           gint          x)
 {
   ThemeImage    *image;
   ThemeMatchData match_data;
@@ -371,12 +389,12 @@ draw_vline(GtkStyle * style,
   g_return_if_fail (window != NULL);
 
   match_data.function = TOKEN_D_VLINE;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
   match_data.state = state;
   match_data.orientation = GTK_ORIENTATION_VERTICAL;
   
-  image = match_theme_image(style, &match_data);
+  image = match_theme_image (style, &match_data);
   if (image)
     {
       if (image->background)
@@ -384,20 +402,23 @@ draw_vline(GtkStyle * style,
                             window, NULL, area, COMPONENT_ALL, FALSE,
                             x, y1, 2, (y2 - y1) + 1);
     }
+  else
+    parent_class->draw_hline (style, window, state, area, widget, detail,
+                             y1, y2, x);
 }
 
 static void
-draw_shadow(GtkStyle style,
-           GdkWindow window,
-           GtkStateType state,
+draw_shadow(GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle * area,
-           GtkWidget widget,
-           gchar * detail,
-           gint x,
-           gint y,
-           gint width,
-           gint height)
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          x,
+           gint          y,
+           gint          width,
+           gint          height)
 {
   ThemeMatchData match_data;
   
@@ -405,13 +426,15 @@ draw_shadow(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_SHADOW;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  draw_simple_image (style, window, area, widget, &match_data, FALSE, FALSE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, FALSE, FALSE,
+                         x, y, width, height))
+    parent_class->draw_shadow (style, window, state, shadow, area, widget, detail,
+                              x, y, width, height);
 }
 
 static void
@@ -421,7 +444,7 @@ draw_polygon(GtkStyle * style,
             GtkShadowType shadow,
             GdkRectangle * area,
             GtkWidget * widget,
-            gchar * detail,
+            const gchar *detail,
             GdkPoint * points,
             gint npoints,
             gint fill)
@@ -495,19 +518,19 @@ draw_polygon(GtkStyle * style,
 }
 
 static void
-draw_arrow(GtkStyle * style,
-          GdkWindow * window,
-          GtkStateType state,
-          GtkShadowType shadow,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          GtkArrowType arrow_direction,
-          gint fill,
-          gint x,
-          gint y,
-          gint width,
-          gint height)
+draw_arrow (GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
+           GtkShadowType shadow,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           GtkArrowType  arrow_direction,
+           gint          fill,
+           gint          x,
+           gint          y,
+           gint          width,
+           gint          height)
 {
   ThemeMatchData match_data;
   
@@ -515,7 +538,7 @@ draw_arrow(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_ARROW;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = (THEME_MATCH_SHADOW | 
                      THEME_MATCH_STATE | 
                      THEME_MATCH_ARROW_DIRECTION);
@@ -523,22 +546,24 @@ draw_arrow(GtkStyle * style,
   match_data.state = state;
   match_data.arrow_direction = arrow_direction;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_arrow (style, window, state, shadow, area, widget, detail,
+                             arrow_direction, fill, x, y, width, height);
 }
 
 static void
-draw_diamond(GtkStyle * style,
-            GdkWindow * window,
-            GtkStateType state,
-            GtkShadowType shadow,
-            GdkRectangle * area,
-            GtkWidget * widget,
-            gchar * detail,
-            gint x,
-            gint y,
-            gint width,
-            gint height)
+draw_diamond (GtkStyle     *style,
+             GdkWindow    *window,
+             GtkStateType  state,
+             GtkShadowType shadow,
+             GdkRectangle *area,
+             GtkWidget    *widget,
+             const gchar  *detail,
+             gint          x,
+             gint          y,
+             gint          width,
+             gint          height)
 {
   ThemeMatchData match_data;
   
@@ -546,27 +571,29 @@ draw_diamond(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_DIAMOND;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_diamond (style, window, state, shadow, area, widget, detail,
+                               x, y, width, height);
 }
 
 static void
-draw_oval(GtkStyle * style,
-         GdkWindow * window,
-         GtkStateType state,
-         GtkShadowType shadow,
-         GdkRectangle * area,
-         GtkWidget * widget,
-         gchar * detail,
-         gint x,
-         gint y,
-         gint width,
-         gint height)
+draw_oval (GtkStyle     *style,
+          GdkWindow    *window,
+          GtkStateType  state,
+          GtkShadowType shadow,
+          GdkRectangle *area,
+          GtkWidget    *widget,
+          const gchar  *detail,
+          gint          x,
+          gint          y,
+          gint          width,
+          gint          height)
 {
   ThemeMatchData match_data;
   
@@ -574,25 +601,27 @@ draw_oval(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_OVAL;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_oval (style, window, state, shadow, area, widget, detail,
+                            x, y, width, height);
 }
 
 static void
-draw_string(GtkStyle * style,
-           GdkWindow * window,
-           GtkStateType state,
-           GdkRectangle * area,
-           GtkWidget * widget,
-           gchar * detail,
-           gint x,
-           gint y,
-           const gchar * string)
+draw_string (GtkStyle * style,
+            GdkWindow * window,
+            GtkStateType state,
+            GdkRectangle * area,
+            GtkWidget * widget,
+            const gchar *detail,
+            gint x,
+            gint y,
+            const gchar * string)
 {
   g_return_if_fail(style != NULL);
   g_return_if_fail(window != NULL);
@@ -622,17 +651,17 @@ draw_string(GtkStyle * style,
 }
 
 static void
-draw_box(GtkStyle * style,
-        GdkWindow * window,
-        GtkStateType state,
-        GtkShadowType shadow,
-        GdkRectangle * area,
-        GtkWidget * widget,
-        gchar * detail,
-        gint x,
-        gint y,
-        gint width,
-        gint height)
+draw_box (GtkStyle     *style,
+         GdkWindow    *window,
+         GtkStateType  state,
+         GtkShadowType shadow,
+         GdkRectangle *area,
+         GtkWidget    *widget,
+         const gchar  *detail,
+         gint          x,
+         gint          y,
+         gint          width,
+         gint          height)
 {
   ThemeMatchData match_data;
 
@@ -640,27 +669,29 @@ draw_box(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_BOX;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
-  
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+                           x, y, width, height);
 }
 
 static void
-draw_flat_box(GtkStyle * style,
-             GdkWindow * window,
-             GtkStateType state,
-             GtkShadowType shadow,
-             GdkRectangle * area,
-             GtkWidget * widget,
-             gchar * detail,
-             gint x,
-             gint y,
-             gint width,
-             gint height)
+draw_flat_box (GtkStyle     *style,
+              GdkWindow    *window,
+              GtkStateType  state,
+              GtkShadowType shadow,
+              GdkRectangle *area,
+              GtkWidget    *widget,
+              const gchar  *detail,
+              gint          x,
+              gint          y,
+              gint          width,
+              gint          height)
 {
   ThemeMatchData match_data;
   
@@ -668,27 +699,29 @@ draw_flat_box(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_FLAT_BOX;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
-  
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,
+                                x, y, width, height);
 }
 
 static void
-draw_check(GtkStyle * style,
-          GdkWindow * window,
-          GtkStateType state,
-          GtkShadowType shadow,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          gint x,
-          gint y,
-          gint width,
-          gint height)
+draw_check (GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
+           GtkShadowType shadow,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          x,
+           gint          y,
+           gint          width,
+           gint          height)
 {
   ThemeMatchData match_data;
   
@@ -696,27 +729,29 @@ draw_check(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_CHECK;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_check (style, window, state, shadow, area, widget, detail,
+                             x, y, width, height);
 }
 
 static void
-draw_option(GtkStyle * style,
-           GdkWindow * window,
-           GtkStateType state,
-           GtkShadowType shadow,
-           GdkRectangle * area,
-           GtkWidget * widget,
-           gchar * detail,
-           gint x,
-           gint y,
-           gint width,
-           gint height)
+draw_option (GtkStyle      *style,
+            GdkWindow     *window,
+            GtkStateType  state,
+            GtkShadowType shadow,
+            GdkRectangle *area,
+            GtkWidget    *widget,
+            const gchar  *detail,
+            gint          x,
+            gint          y,
+            gint          width,
+            gint          height)
 {
   ThemeMatchData match_data;
   
@@ -724,27 +759,29 @@ draw_option(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_OPTION;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_option (style, window, state, shadow, area, widget, detail,
+                              x, y, width, height);
 }
 
 static void
-draw_cross(GtkStyle * style,
-          GdkWindow * window,
-          GtkStateType state,
-          GtkShadowType shadow,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          gint x,
-          gint y,
-          gint width,
-          gint height)
+draw_cross (GtkStyle     *style,
+           GdkWindow    *window,
+           GtkStateType  state,
+           GtkShadowType shadow,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          x,
+           gint          y,
+           gint          width,
+           gint          height)
 {
   ThemeMatchData match_data;
   
@@ -752,28 +789,30 @@ draw_cross(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_CROSS;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_cross (style, window, state, shadow, area, widget, detail,
+                             x, y, width, height);
 }
 
 static void
-draw_ramp(GtkStyle * style,
-         GdkWindow * window,
-         GtkStateType state,
-         GtkShadowType shadow,
-         GdkRectangle * area,
-         GtkWidget * widget,
-         gchar * detail,
-         GtkArrowType arrow_direction,
-         gint x,
-         gint y,
-         gint width,
-         gint height)
+draw_ramp (GtkStyle     *style,
+          GdkWindow    *window,
+          GtkStateType  state,
+          GtkShadowType shadow,
+          GdkRectangle *area,
+          GtkWidget    *widget,
+          const gchar  *detail,
+          GtkArrowType  arrow_direction,
+          gint          x,
+          gint          y,
+          gint          width,
+          gint          height)
 {
   ThemeMatchData match_data;
   
@@ -781,27 +820,29 @@ draw_ramp(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_RAMP;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_ramp (style, window, state, shadow, area, widget, detail,
+                            arrow_direction, x, y, width, height);
 }
 
 static void
-draw_tab(GtkStyle * style,
-        GdkWindow * window,
-        GtkStateType state,
-        GtkShadowType shadow,
-        GdkRectangle * area,
-        GtkWidget * widget,
-        gchar * detail,
-        gint x,
-        gint y,
-        gint width,
-        gint height)
+draw_tab (GtkStyle     *style,
+         GdkWindow    *window,
+         GtkStateType  state,
+         GtkShadowType shadow,
+         GdkRectangle *area,
+         GtkWidget    *widget,
+         const gchar  *detail,
+         gint          x,
+         gint          y,
+         gint          width,
+         gint          height)
 {
   ThemeMatchData match_data;
   
@@ -809,35 +850,37 @@ draw_tab(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_TAB;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_tab (style, window, state, shadow, area, widget, detail,
+                           x, y, width, height);
 }
 
 static void
-draw_shadow_gap(GtkStyle * style,
-               GdkWindow * window,
-               GtkStateType state,
-               GtkShadowType shadow,
-               GdkRectangle * area,
-               GtkWidget * widget,
-               gchar * detail,
-               gint x,
-               gint y,
-               gint width,
-               gint height,
-               GtkPositionType gap_side,
-               gint gap_x,
-               gint gap_width)
+draw_shadow_gap (GtkStyle       *style,
+                GdkWindow      *window,
+                GtkStateType    state,
+                GtkShadowType   shadow,
+                GdkRectangle   *area,
+                GtkWidget      *widget,
+                const gchar    *detail,
+                gint            x,
+                gint            y,
+                gint            width,
+                gint            height,
+                GtkPositionType gap_side,
+                gint            gap_x,
+                gint            gap_width)
 {
   ThemeMatchData match_data;
   
   match_data.function = TOKEN_D_SHADOW_GAP;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.flags = (THEME_MATCH_SHADOW | 
                      THEME_MATCH_STATE | 
@@ -845,30 +888,32 @@ draw_shadow_gap(GtkStyle * style,
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_gap_image (style, window, area, widget, &match_data, FALSE,
-                 x, y, width, height, gap_side, gap_x, gap_width);
+  if (!draw_gap_image (style, window, area, widget, &match_data, FALSE,
+                      x, y, width, height, gap_side, gap_x, gap_width))
+    parent_class->draw_shadow_gap (style, window, state, shadow, area, widget, detail,
+                                  x, y, width, height, gap_side, gap_x, gap_width);
 }
 
 static void
-draw_box_gap(GtkStyle * style,
-            GdkWindow * window,
-            GtkStateType state,
-            GtkShadowType shadow,
-            GdkRectangle * area,
-            GtkWidget * widget,
-            gchar * detail,
-            gint x,
-            gint y,
-            gint width,
-            gint height,
-            GtkPositionType gap_side,
-            gint gap_x,
-            gint gap_width)
+draw_box_gap (GtkStyle       *style,
+             GdkWindow      *window,
+             GtkStateType    state,
+             GtkShadowType   shadow,
+             GdkRectangle   *area,
+             GtkWidget      *widget,
+             const gchar    *detail,
+             gint            x,
+             gint            y,
+             gint            width,
+             gint            height,
+             GtkPositionType gap_side,
+             gint            gap_x,
+             gint            gap_width)
 {
   ThemeMatchData match_data;
   
   match_data.function = TOKEN_D_BOX_GAP;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.flags = (THEME_MATCH_SHADOW | 
                      THEME_MATCH_STATE | 
@@ -876,23 +921,25 @@ draw_box_gap(GtkStyle * style,
   match_data.shadow = shadow;
   match_data.state = state;
   
-  draw_gap_image (style, window, area, widget, &match_data, TRUE,
-                 x, y, width, height, gap_side, gap_x, gap_width);
+  if (!draw_gap_image (style, window, area, widget, &match_data, TRUE,
+                      x, y, width, height, gap_side, gap_x, gap_width))
+    parent_class->draw_box_gap (style, window, state, shadow, area, widget, detail,
+                               x, y, width, height, gap_side, gap_x, gap_width);
 }
 
 static void
-draw_extension(GtkStyle * style,
-              GdkWindow * window,
-              GtkStateType state,
-              GtkShadowType shadow,
-              GdkRectangle * area,
-              GtkWidget * widget,
-              gchar * detail,
-              gint x,
-              gint y,
-              gint width,
-              gint height,
-              GtkPositionType gap_side)
+draw_extension (GtkStyle       *style,
+               GdkWindow      *window,
+               GtkStateType    state,
+               GtkShadowType   shadow,
+               GdkRectangle   *area,
+               GtkWidget      *widget,
+               const gchar    *detail,
+               gint            x,
+               gint            y,
+               gint            width,
+               gint            height,
+               GtkPositionType gap_side)
 {
   ThemeMatchData match_data;
   
@@ -906,26 +953,28 @@ draw_extension(GtkStyle * style,
     height++;
   
   match_data.function = TOKEN_D_EXTENSION;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE | THEME_MATCH_GAP_SIDE;
   match_data.shadow = shadow;
   match_data.state = state;
   match_data.gap_side = gap_side;
-  
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_extension (style, window, state, shadow, area, widget, detail,
+                                 x, y, width, height, gap_side);
 }
 
 static void
-draw_focus(GtkStyle * style,
-          GdkWindow * window,
-          GdkRectangle * area,
-          GtkWidget * widget,
-          gchar * detail,
-          gint x,
-          gint y,
-          gint width,
-          gint height)
+draw_focus (GtkStyle     *style,
+           GdkWindow    *window,
+           GdkRectangle *area,
+           GtkWidget    *widget,
+           const gchar  *detail,
+           gint          x,
+           gint          y,
+           gint          width,
+           gint          height)
 {
   ThemeMatchData match_data;
   
@@ -939,26 +988,28 @@ draw_focus(GtkStyle * style,
     height++;
 
   match_data.function = TOKEN_D_FOCUS;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = 0;
   
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, FALSE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, FALSE,
+                         x, y, width, height))
+    parent_class->draw_focus (style, window, area, widget, detail,
+                             x, y, width, height);
 }
 
 static void
-draw_slider(GtkStyle * style,
-           GdkWindow * window,
-           GtkStateType state,
-           GtkShadowType shadow,
-           GdkRectangle * area,
-           GtkWidget * widget,
-           gchar * detail,
-           gint x,
-           gint y,
-           gint width,
-           gint height,
-           GtkOrientation orientation)
+draw_slider (GtkStyle      *style,
+            GdkWindow     *window,
+            GtkStateType   state,
+            GtkShadowType  shadow,
+            GdkRectangle  *area,
+            GtkWidget     *widget,
+            const gchar   *detail,
+            gint           x,
+            gint           y,
+            gint           width,
+            gint           height,
+            GtkOrientation orientation)
 {
   ThemeMatchData           match_data;
   
@@ -966,7 +1017,7 @@ draw_slider(GtkStyle * style,
   g_return_if_fail(window != NULL);
 
   match_data.function = TOKEN_D_SLIDER;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = (THEME_MATCH_SHADOW | 
                      THEME_MATCH_STATE | 
                      THEME_MATCH_ORIENTATION);
@@ -974,23 +1025,26 @@ draw_slider(GtkStyle * style,
   match_data.state = state;
   match_data.orientation = orientation;
 
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);}
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_slider (style, window, state, shadow, area, widget, detail,
+                              x, y, width, height, orientation);
+}
 
 
 static void
-draw_handle(GtkStyle * style,
-           GdkWindow * window,
-           GtkStateType state,
-           GtkShadowType shadow,
-           GdkRectangle * area,
-           GtkWidget * widget,
-           gchar * detail,
-           gint x,
-           gint y,
-           gint width,
-           gint height,
-           GtkOrientation orientation)
+draw_handle (GtkStyle      *style,
+            GdkWindow     *window,
+            GtkStateType   state,
+            GtkShadowType  shadow,
+            GdkRectangle  *area,
+            GtkWidget     *widget,
+            const gchar   *detail,
+            gint           x,
+            gint           y,
+            gint           width,
+            gint           height,
+            GtkOrientation orientation)
 {
   ThemeMatchData match_data;
   
@@ -998,7 +1052,7 @@ draw_handle(GtkStyle * style,
   g_return_if_fail (window != NULL);
 
   match_data.function = TOKEN_D_HANDLE;
-  match_data.detail = detail;
+  match_data.detail = (gchar *)detail;
   match_data.flags = (THEME_MATCH_SHADOW | 
                      THEME_MATCH_STATE | 
                      THEME_MATCH_ORIENTATION);
@@ -1006,34 +1060,67 @@ draw_handle(GtkStyle * style,
   match_data.state = state;
   match_data.orientation = orientation;
 
-  draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
-                    x, y, width, height);
+  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_handle (style, window, state, shadow, area, widget, detail,
+                              x, y, width, height, orientation);
 }
 
-GtkStyleClass pixmap_default_class =
+GType pixbuf_type_style = 0;
+
+void
+pixbuf_style_register_type (GtkThemeEngine *engine)
 {
-  2,
-  2,
-  draw_hline,
-  draw_vline,
-  draw_shadow,
-  draw_polygon,
-  draw_arrow,
-  draw_diamond,
-  draw_oval,
-  draw_string,
-  draw_box,
-  draw_flat_box,
-  draw_check,
-  draw_option,
-  draw_cross,
-  draw_ramp,
-  draw_tab,
-  draw_shadow_gap,
-  draw_box_gap,
-  draw_extension,
-  draw_focus,
-  draw_slider,
-  draw_handle
-};
+  static const GTypeInfo object_info =
+  {
+    sizeof (PixbufStyleClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) pixbuf_style_class_init,
+    NULL,           /* class_finalize */
+    NULL,           /* class_data */
+    sizeof (PixbufStyle),
+    0,              /* n_preallocs */
+    (GInstanceInitFunc) pixbuf_style_init,
+  };
+  
+  pixbuf_type_style = gtk_theme_engine_register_type (engine,
+                                                     GTK_TYPE_STYLE,
+                                                     "PixbufStyle",
+                                                     &object_info);
+}
+
+static void
+pixbuf_style_init (PixbufStyle *style)
+{
+}
 
+static void
+pixbuf_style_class_init (PixbufStyleClass *klass)
+{
+  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  style_class->draw_hline = draw_hline;
+  style_class->draw_vline = draw_vline;
+  style_class->draw_shadow = draw_shadow;
+  style_class->draw_polygon = draw_polygon;
+  style_class->draw_arrow = draw_arrow;
+  style_class->draw_diamond = draw_diamond;
+  style_class->draw_oval = draw_oval;
+  style_class->draw_string = draw_string;
+  style_class->draw_box = draw_box;
+  style_class->draw_flat_box = draw_flat_box;
+  style_class->draw_check = draw_check;
+  style_class->draw_option = draw_option;
+  style_class->draw_cross = draw_cross;
+  style_class->draw_ramp = draw_ramp;
+  style_class->draw_tab = draw_tab;
+  style_class->draw_shadow_gap = draw_shadow_gap;
+  style_class->draw_box_gap = draw_box_gap;
+  style_class->draw_extension = draw_extension;
+  style_class->draw_focus = draw_focus;
+  style_class->draw_slider = draw_slider;
+  style_class->draw_handle = draw_handle;
+}
index c0998d37e5bb1ee55ff433a0b472fcb49af845fb..be731bbb5e0eb80fb175d224b898f3ef7b6232ec 100644 (file)
  */
 
 #include "pixbuf.h"
+#include "pixbuf-style.h"
+#include "pixbuf-rc-style.h"
 #include <gmodule.h>
 
-/* Theme functions to export */
-void                theme_init(GtkThemeEngine * engine);
-void                theme_exit(void);
-
-static struct
-  {
-    gchar              *name;
-    guint               token;
-  }
-theme_symbols[] =
-{
-  { "image",           TOKEN_IMAGE  },
-  { "function",        TOKEN_FUNCTION },
-  { "file",            TOKEN_FILE },
-  { "stretch",                 TOKEN_STRETCH },
-  { "recolorable",     TOKEN_RECOLORABLE },
-  { "border",          TOKEN_BORDER },
-  { "detail",          TOKEN_DETAIL },
-  { "state",           TOKEN_STATE },
-  { "shadow",          TOKEN_SHADOW },
-  { "gap_side",        TOKEN_GAP_SIDE },
-  { "gap_file",        TOKEN_GAP_FILE },
-  { "gap_border",      TOKEN_GAP_BORDER },
-  { "gap_start_file",  TOKEN_GAP_START_FILE },
-  { "gap_start_border", TOKEN_GAP_START_BORDER },
-  { "gap_end_file",    TOKEN_GAP_END_FILE },
-  { "gap_end_border",  TOKEN_GAP_END_BORDER },
-  { "overlay_file",    TOKEN_OVERLAY_FILE },
-  { "overlay_border",  TOKEN_OVERLAY_BORDER },
-  { "overlay_stretch",         TOKEN_OVERLAY_STRETCH },
-  { "arrow_direction",         TOKEN_ARROW_DIRECTION },
-  { "orientation",     TOKEN_ORIENTATION },
-
-  { "HLINE",           TOKEN_D_HLINE },
-  { "VLINE",           TOKEN_D_VLINE },
-  { "SHADOW",          TOKEN_D_SHADOW },
-  { "POLYGON",         TOKEN_D_POLYGON },
-  { "ARROW",           TOKEN_D_ARROW },
-  { "DIAMOND",         TOKEN_D_DIAMOND },
-  { "OVAL",            TOKEN_D_OVAL },
-  { "STRING",          TOKEN_D_STRING },
-  { "BOX",             TOKEN_D_BOX },
-  { "FLAT_BOX",                TOKEN_D_FLAT_BOX },
-  { "CHECK",           TOKEN_D_CHECK },
-  { "OPTION",          TOKEN_D_OPTION },
-  { "CROSS",           TOKEN_D_CROSS },
-  { "RAMP",            TOKEN_D_RAMP },
-  { "TAB",             TOKEN_D_TAB },
-  { "SHADOW_GAP",      TOKEN_D_SHADOW_GAP },
-  { "BOX_GAP",         TOKEN_D_BOX_GAP },
-  { "EXTENSION",       TOKEN_D_EXTENSION },
-  { "FOCUS",           TOKEN_D_FOCUS },
-  { "SLIDER",          TOKEN_D_SLIDER },
-  { "ENTRY",           TOKEN_D_ENTRY },
-  { "HANDLE",          TOKEN_D_HANDLE },
-
-  { "TRUE",            TOKEN_TRUE },
-  { "FALSE",           TOKEN_FALSE },
-
-  { "TOP",             TOKEN_TOP },
-  { "UP",              TOKEN_UP },
-  { "BOTTOM",          TOKEN_BOTTOM },
-  { "DOWN",            TOKEN_DOWN },
-  { "LEFT",            TOKEN_LEFT },
-  { "RIGHT",           TOKEN_RIGHT },
-
-  { "NORMAL",          TOKEN_NORMAL },
-  { "ACTIVE",          TOKEN_ACTIVE },
-  { "PRELIGHT",                TOKEN_PRELIGHT },
-  { "SELECTED",                TOKEN_SELECTED },
-  { "INSENSITIVE",     TOKEN_INSENSITIVE },
-
-  { "NONE",            TOKEN_NONE },
-  { "IN",              TOKEN_IN },
-  { "OUT",             TOKEN_OUT },
-  { "ETCHED_IN",       TOKEN_ETCHED_IN },
-  { "ETCHED_OUT",      TOKEN_ETCHED_OUT },
-  { "HORIZONTAL",      TOKEN_HORIZONTAL },
-  { "VERTICAL",                TOKEN_VERTICAL },
-};
-
-static guint        n_theme_symbols = sizeof(theme_symbols) / sizeof(theme_symbols[0]);
-
-static guint
-theme_parse_file(GScanner     *scanner,
-                ThemePixbuf **theme_pb)
-{
-  guint token;
-  gchar *pixmap;
-
-  /* Skip 'blah_file' */
-  token = g_scanner_get_next_token(scanner);
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_STRING)
-    return G_TOKEN_STRING;
-
-  if (!*theme_pb)
-    *theme_pb = theme_pixbuf_new ();
-
-  pixmap = gtk_rc_find_pixmap_in_path(scanner, scanner->value.v_string);
-  if (pixmap)
-    {
-      theme_pixbuf_set_filename (*theme_pb, pixmap);
-      g_free (pixmap);
-    }
-
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_border (GScanner     *scanner,
-                   ThemePixbuf **theme_pb)
-{
-  guint               token;
-  gint left, right, top, bottom;
-
-  /* Skip 'blah_border' */
-  token = g_scanner_get_next_token(scanner);
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_LEFT_CURLY)
-    return G_TOKEN_LEFT_CURLY;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_INT)
-    return G_TOKEN_INT;
-  left = scanner->value.v_int;
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_COMMA)
-    return G_TOKEN_COMMA;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_INT)
-    return G_TOKEN_INT;
-  right = scanner->value.v_int;
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_COMMA)
-    return G_TOKEN_COMMA;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_INT)
-    return G_TOKEN_INT;
-  top = scanner->value.v_int;
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_COMMA)
-    return G_TOKEN_COMMA;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_INT)
-    return G_TOKEN_INT;
-  bottom = scanner->value.v_int;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_RIGHT_CURLY)
-    return G_TOKEN_RIGHT_CURLY;
-
-  if (!*theme_pb)
-    *theme_pb = theme_pixbuf_new ();
-  
-  theme_pixbuf_set_border (*theme_pb, left, right, top, bottom);
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_stretch(GScanner     *scanner,
-                   ThemePixbuf **theme_pb)
-{
-  guint token;
-  gboolean stretch;
-
-  /* Skip 'blah_stretch' */
-  token = g_scanner_get_next_token(scanner);
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token == TOKEN_TRUE)
-    stretch = TRUE;
-  else if (token == TOKEN_FALSE)
-    stretch = FALSE;
-  else
-    return TOKEN_TRUE;
-
-  if (!*theme_pb)
-    *theme_pb = theme_pixbuf_new ();
-  
-  theme_pixbuf_set_stretch (*theme_pb, stretch);
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_recolorable(GScanner * scanner,
-                       ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_RECOLORABLE)
-    return TOKEN_RECOLORABLE;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token == TOKEN_TRUE)
-    data->recolorable = 1;
-  else if (token == TOKEN_FALSE)
-    data->recolorable = 0;
-  else
-    return TOKEN_TRUE;
-
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_function(GScanner * scanner,
-                    ThemeImage *data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_FUNCTION)
-    return TOKEN_FUNCTION;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if ((token >= TOKEN_D_HLINE) && (token <= TOKEN_D_HANDLE))
-    data->match_data.function = token;
-
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_detail(GScanner * scanner,
-                  ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_DETAIL)
-    return TOKEN_DETAIL;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_STRING)
-    return G_TOKEN_STRING;
-
-  if (data->match_data.detail)
-    g_free (data->match_data.detail);
-  
-  data->match_data.detail = g_strdup(scanner->value.v_string);
-
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_state(GScanner * scanner,
-                 ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_STATE)
-    return TOKEN_STATE;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token == TOKEN_NORMAL)
-    data->match_data.state = GTK_STATE_NORMAL;
-  else if (token == TOKEN_ACTIVE)
-    data->match_data.state = GTK_STATE_ACTIVE;
-  else if (token == TOKEN_PRELIGHT)
-    data->match_data.state = GTK_STATE_PRELIGHT;
-  else if (token == TOKEN_SELECTED)
-    data->match_data.state = GTK_STATE_SELECTED;
-  else if (token == TOKEN_INSENSITIVE)
-    data->match_data.state = GTK_STATE_INSENSITIVE;
-  else
-    return TOKEN_NORMAL;
-
-  data->match_data.flags |= THEME_MATCH_STATE;
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_shadow(GScanner * scanner,
-                  ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_SHADOW)
-    return TOKEN_SHADOW;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token == TOKEN_NONE)
-    data->match_data.shadow = GTK_SHADOW_NONE;
-  else if (token == TOKEN_IN)
-    data->match_data.shadow = GTK_SHADOW_IN;
-  else if (token == TOKEN_OUT)
-    data->match_data.shadow = GTK_SHADOW_OUT;
-  else if (token == TOKEN_ETCHED_IN)
-    data->match_data.shadow = GTK_SHADOW_ETCHED_IN;
-  else if (token == TOKEN_ETCHED_OUT)
-    data->match_data.shadow = GTK_SHADOW_ETCHED_OUT;
-  else
-    return TOKEN_NONE;
-
-  data->match_data.flags |= THEME_MATCH_SHADOW;
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_arrow_direction(GScanner * scanner,
-                           ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_ARROW_DIRECTION)
-    return TOKEN_ARROW_DIRECTION;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token == TOKEN_UP)
-    data->match_data.arrow_direction = GTK_ARROW_UP;
-  else if (token == TOKEN_DOWN)
-    data->match_data.arrow_direction = GTK_ARROW_DOWN;
-  else if (token == TOKEN_LEFT)
-    data->match_data.arrow_direction = GTK_ARROW_LEFT;
-  else if (token == TOKEN_RIGHT)
-    data->match_data.arrow_direction = GTK_ARROW_RIGHT;
-  else
-    return TOKEN_UP;
-
-  data->match_data.flags |= THEME_MATCH_ARROW_DIRECTION;
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_gap_side(GScanner * scanner,
-                    ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_GAP_SIDE)
-    return TOKEN_GAP_SIDE;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-
-  if (token == TOKEN_TOP)
-    data->match_data.gap_side = GTK_POS_TOP;
-  else if (token == TOKEN_BOTTOM)
-    data->match_data.gap_side = GTK_POS_BOTTOM;
-  else if (token == TOKEN_LEFT)
-    data->match_data.gap_side = GTK_POS_LEFT;
-  else if (token == TOKEN_RIGHT)
-    data->match_data.gap_side = GTK_POS_RIGHT;
-  else
-    return TOKEN_TOP;
-
-  data->match_data.flags |= THEME_MATCH_GAP_SIDE;
-  
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_orientation(GScanner * scanner,
-                       ThemeImage * data)
-{
-  guint               token;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_ORIENTATION)
-    return TOKEN_ORIENTATION;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_EQUAL_SIGN)
-    return G_TOKEN_EQUAL_SIGN;
-
-  token = g_scanner_get_next_token(scanner);
-
-  if (token == TOKEN_HORIZONTAL)
-    data->match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
-  else if (token == TOKEN_VERTICAL)
-    data->match_data.orientation = GTK_ORIENTATION_VERTICAL;
-  else
-    return TOKEN_HORIZONTAL;
-
-  data->match_data.flags |= THEME_MATCH_ORIENTATION;
-  
-  return G_TOKEN_NONE;
-}
-
-static void
-theme_image_ref (ThemeImage *data)
-{
-  data->refcount++;
-}
-
-static void
-theme_image_unref (ThemeImage *data)
-{
-  data->refcount--;
-  if (data->refcount == 0)
-    {
-      if (data->match_data.detail)
-       g_free (data->match_data.detail);
-      if (data->background)
-       theme_pixbuf_destroy (data->background);
-      if (data->overlay)
-       theme_pixbuf_destroy (data->overlay);
-      if (data->gap_start)
-       theme_pixbuf_destroy (data->gap_start);
-      if (data->gap)
-       theme_pixbuf_destroy (data->gap);
-      if (data->gap_end)
-       theme_pixbuf_destroy (data->gap_end);
-      g_free (data);
-    }
-}
-
-static void
-theme_data_ref (ThemeData *theme_data)
-{
-  theme_data->refcount++;
-}
-
-static void
-theme_data_unref (ThemeData *theme_data)
-{
-  theme_data->refcount--;
-  if (theme_data->refcount == 0)
-    {
-      g_list_foreach (theme_data->img_list, (GFunc) theme_image_unref, NULL);
-      g_list_free (theme_data->img_list);
-      g_free (theme_data);
-    }
-}
-
-static guint
-theme_parse_image(GScanner *scanner,
-                 ThemeData *theme_data,
-                 ThemeImage **data_return)
-{
-  guint               token;
-  ThemeImage *data;
-
-  data = NULL;
-  token = g_scanner_get_next_token(scanner);
-  if (token != TOKEN_IMAGE)
-    return TOKEN_IMAGE;
-
-  token = g_scanner_get_next_token(scanner);
-  if (token != G_TOKEN_LEFT_CURLY)
-    return G_TOKEN_LEFT_CURLY;
-
-  data = g_malloc(sizeof(ThemeImage));
-
-  data->refcount = 1;
-
-  data->background = NULL;
-  data->overlay = NULL;
-  data->gap_start = NULL;
-  data->gap = NULL;
-  data->gap_end = NULL;
-
-  data->recolorable = FALSE;
-
-  data->match_data.function = 0;
-  data->match_data.detail = NULL;
-  data->match_data.flags = 0;
-
-  token = g_scanner_peek_next_token(scanner);
-  while (token != G_TOKEN_RIGHT_CURLY)
-    {
-      switch (token)
-       {
-       case TOKEN_FUNCTION:
-         token = theme_parse_function(scanner, data);
-         break;
-       case TOKEN_RECOLORABLE:
-         token = theme_parse_recolorable(scanner, data);
-         break;
-       case TOKEN_DETAIL:
-         token = theme_parse_detail(scanner, data);
-         break;
-       case TOKEN_STATE:
-         token = theme_parse_state(scanner, data);
-         break;
-       case TOKEN_SHADOW:
-         token = theme_parse_shadow(scanner, data);
-         break;
-       case TOKEN_GAP_SIDE:
-         token = theme_parse_gap_side(scanner, data);
-         break;
-       case TOKEN_ARROW_DIRECTION:
-         token = theme_parse_arrow_direction(scanner, data);
-         break;
-       case TOKEN_ORIENTATION:
-         token = theme_parse_orientation(scanner, data);
-         break;
-       case TOKEN_FILE:
-         token = theme_parse_file(scanner, &data->background);
-         break;
-       case TOKEN_BORDER:
-         token = theme_parse_border(scanner, &data->background);
-         break;
-       case TOKEN_STRETCH:
-         token = theme_parse_stretch(scanner, &data->background);
-         break;
-       case TOKEN_GAP_FILE:
-         token = theme_parse_file(scanner, &data->gap);
-         break;
-       case TOKEN_GAP_BORDER:
-         token = theme_parse_border(scanner, &data->gap);
-         break;
-       case TOKEN_GAP_START_FILE:
-         token = theme_parse_file(scanner, &data->gap_start);
-         break;
-       case TOKEN_GAP_START_BORDER:
-         token = theme_parse_border(scanner, &data->gap_start);
-         break;
-       case TOKEN_GAP_END_FILE:
-         token = theme_parse_file(scanner, &data->gap_end);
-         break;
-       case TOKEN_GAP_END_BORDER:
-         token = theme_parse_border(scanner, &data->gap_end);
-         break;
-       case TOKEN_OVERLAY_FILE:
-         token = theme_parse_file(scanner, &data->overlay);
-         break;
-       case TOKEN_OVERLAY_BORDER:
-         token = theme_parse_border(scanner, &data->overlay);
-         break;
-       case TOKEN_OVERLAY_STRETCH:
-         token = theme_parse_stretch(scanner, &data->overlay);
-         break;
-       default:
-         g_scanner_get_next_token(scanner);
-         token = G_TOKEN_RIGHT_CURLY;
-         break;
-       }
-      if (token != G_TOKEN_NONE)
-       {
-         /* error - cleanup for exit */
-         theme_image_unref (data);
-         *data_return = NULL;
-         return token;
-       }
-      token = g_scanner_peek_next_token(scanner);
-    }
-
-  token = g_scanner_get_next_token(scanner);
-
-  if (token != G_TOKEN_RIGHT_CURLY)
-    {
-      /* error - cleanup for exit */
-      theme_image_unref (data);
-      *data_return = NULL;
-      return G_TOKEN_RIGHT_CURLY;
-    }
-
-  /* everything is fine now - insert yer cruft */
-  *data_return = data;
-  return G_TOKEN_NONE;
-}
-
-static guint
-theme_parse_rc_style(GScanner * scanner,
-                    GtkRcStyle * rc_style)
-{
-  static GQuark scope_id = 0;
-  ThemeData *theme_data;
-  guint old_scope;
-  guint token;
-  gint i;
-  ThemeImage *img;
-  
-  /* Set up a new scope in this scanner. */
-
-  if (!scope_id)
-    scope_id = g_quark_from_string("theme_engine");
-
-  /* If we bail out due to errors, we *don't* reset the scope, so the
-   * error messaging code can make sense of our tokens.
-   */
-  old_scope = g_scanner_set_scope(scanner, scope_id);
-
-  /* Now check if we already added our symbols to this scope
-   * (in some previous call to theme_parse_rc_style for the
-   * same scanner.
-   */
-
-  if (!g_scanner_lookup_symbol(scanner, theme_symbols[0].name))
-    {
-      g_scanner_freeze_symbol_table(scanner);
-      for (i = 0; i < n_theme_symbols; i++)
-       g_scanner_scope_add_symbol(scanner, scope_id,
-                                  theme_symbols[i].name,
-                                  GINT_TO_POINTER(theme_symbols[i].token));
-      g_scanner_thaw_symbol_table(scanner);
-    }
-
-  /* We're ready to go, now parse the top level */
-
-  theme_data = g_new(ThemeData, 1);
-  theme_data->img_list = NULL;
-  theme_data->refcount = 1;
-
-  token = g_scanner_peek_next_token(scanner);
-  while (token != G_TOKEN_RIGHT_CURLY)
-    {
-      switch (token)
-       {
-       case TOKEN_IMAGE:
-         img = NULL;
-         token = theme_parse_image(scanner, theme_data, &img);
-         break;
-       default:
-         g_scanner_get_next_token(scanner);
-         token = G_TOKEN_RIGHT_CURLY;
-         break;
-       }
-
-      if (token != G_TOKEN_NONE)
-       {
-         g_list_foreach (theme_data->img_list, (GFunc)theme_image_unref, NULL);
-         g_list_free (theme_data->img_list);
-         g_free (theme_data);
-         return token;
-       }
-      else
-       {
-         theme_data->img_list = g_list_append(theme_data->img_list, img);
-       }
-      token = g_scanner_peek_next_token(scanner);
-    }
-
-  g_scanner_get_next_token(scanner);
-
-  rc_style->engine_data = theme_data;
-  g_scanner_set_scope(scanner, old_scope);
-
-  return G_TOKEN_NONE;
-}
-
-static void
-theme_merge_rc_style(GtkRcStyle * dest,
-                    GtkRcStyle * src)
-{
-  ThemeData        *src_data = src->engine_data;
-  ThemeData        *dest_data = dest->engine_data;
-  GList *tmp_list1, *tmp_list2;
-
-  if (!dest_data)
-    {
-      dest_data = g_new(ThemeData, 1);
-      dest_data->img_list = NULL;
-      dest_data->refcount = 1;
-      dest->engine_data = dest_data;
-    }
-
-  if (src_data->img_list)
-    {
-      /* Copy src image list and append to dest image list */
-
-      tmp_list2 = g_list_last (dest_data->img_list);
-      tmp_list1 = src_data->img_list;
-      
-      while (tmp_list1)
-       {
-         if (tmp_list2)
-           {
-             tmp_list2->next = g_list_alloc();
-             tmp_list2->next->data = tmp_list1->data;
-             tmp_list2->next->prev = tmp_list2;
-
-             tmp_list2 = tmp_list2->next;
-           }
-         else
-           {
-             dest_data->img_list = g_list_append (NULL, tmp_list1->data);
-             tmp_list2 = dest_data->img_list;
-           }
-         
-         theme_data_ref (tmp_list1->data);
-         tmp_list1 = tmp_list1->next;
-       }
-    }
-}
-
-static void
-theme_rc_style_to_style(GtkStyle * style,
-                       GtkRcStyle * rc_style)
-{
-  ThemeData        *data = rc_style->engine_data;
-
-  style->klass = &pixmap_default_class;
-  style->engine_data = data;
-  theme_data_ref (data);
-}
-
-static void
-theme_duplicate_style(GtkStyle * dest,
-                     GtkStyle * src)
-{
-  ThemeData     *src_data = src->engine_data;
-  ThemeData     *dest_data;
-
-  dest_data = g_new(ThemeData, 1);
-  dest_data->img_list = g_list_copy (src_data->img_list);
-  g_list_foreach (dest_data->img_list, (GFunc)theme_image_ref, NULL);
-
-  dest->klass = &pixmap_default_class;
-  dest->engine_data = dest_data;
-  theme_data_ref (dest_data);
-}
-
-static void
-theme_realize_style(GtkStyle * style)
-{
-}
-
-static void
-theme_unrealize_style(GtkStyle * style)
-{
-}
-
-static void
-theme_destroy_rc_style(GtkRcStyle * rc_style)
-{
-  theme_data_unref (rc_style->engine_data);
-}
-
-static void
-theme_destroy_style(GtkStyle * style)
-{
-  theme_data_unref (style->engine_data);
-}
-
-static void
-theme_set_background(GtkStyle * style,
-                    GdkWindow * window,
-                    GtkStateType state_type)
+G_MODULE_EXPORT void
+theme_init(GtkThemeEngine * engine)
 {
-  GdkPixmap          *pixmap;
-  gint                parent_relative;
-
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
-  if (style->bg_pixmap[state_type])
-    {
-      if (style->bg_pixmap[state_type] == (GdkPixmap *) GDK_PARENT_RELATIVE)
-       {
-         pixmap = NULL;
-         parent_relative = TRUE;
-       }
-      else
-       {
-         pixmap = style->bg_pixmap[state_type];
-         parent_relative = FALSE;
-       }
-
-      gdk_window_set_back_pixmap(window, pixmap, parent_relative);
-    }
-  else
-    gdk_window_set_background(window, &style->bg[state_type]);
+  pixbuf_rc_style_register_type (engine);
+  pixbuf_style_register_type (engine);
 }
 
-void
-theme_init(GtkThemeEngine * engine)
+G_MODULE_EXPORT void
+theme_exit(void)
 {
-  engine->parse_rc_style = theme_parse_rc_style;
-  engine->merge_rc_style = theme_merge_rc_style;
-  engine->rc_style_to_style = theme_rc_style_to_style;
-  engine->duplicate_style = theme_duplicate_style;
-  engine->realize_style = theme_realize_style;
-  engine->unrealize_style = theme_unrealize_style;
-  engine->destroy_rc_style = theme_destroy_rc_style;
-  engine->destroy_style = theme_destroy_style;
-  engine->set_background = theme_set_background;
-
-  gdk_rgb_init();
-
-  /*
-   * We enable the caches unconditionally (the -1 is used
-   * to inform gnome-libs to ignore its setting for the
-   * cache
-   */
-#if 0
-  gtk_widget_push_visual(gdk_imlib_get_visual());
-  gtk_widget_push_colormap(gdk_imlib_get_colormap());
-#endif /* 0 */  
 }
 
-void
-theme_exit(void)
+G_MODULE_EXPORT GtkRcStyle *
+theme_create_rc_style (void)
 {
+  return GTK_RC_STYLE (g_object_new (PIXBUF_TYPE_RC_STYLE, NULL));  
 }
 
 /* The following function will be called by GTK+ when the module
diff --git a/modules/engines/pixbuf/pixbuf-rc-style.c b/modules/engines/pixbuf/pixbuf-rc-style.c
new file mode 100644 (file)
index 0000000..c221ae1
--- /dev/null
@@ -0,0 +1,796 @@
+/* GTK+ Pixbuf Engine
+ * Copyright (C) 1998-2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Written by Owen Taylor <otaylor@redhat.com>, based on code by
+ * Carsten Haitzler <raster@rasterman.com>
+ */
+
+#include "pixbuf.h"
+#include "pixbuf-style.h"
+#include "pixbuf-rc-style.h"
+
+static void      pixbuf_rc_style_init         (PixbufRcStyle      *style);
+static void      pixbuf_rc_style_class_init   (PixbufRcStyleClass *klass);
+static void      pixbuf_rc_style_finalize     (GObject            *object);
+static guint     pixbuf_rc_style_parse        (GtkRcStyle         *rc_style,
+                                              GScanner           *scanner);
+static void      pixbuf_rc_style_merge        (GtkRcStyle         *dest,
+                                              GtkRcStyle         *src);
+static GtkStyle *pixbuf_rc_style_create_style (GtkRcStyle         *rc_style);
+
+static void theme_image_unref (ThemeImage *data);
+
+static struct
+  {
+    gchar              *name;
+    guint               token;
+  }
+theme_symbols[] =
+{
+  { "image",           TOKEN_IMAGE  },
+  { "function",        TOKEN_FUNCTION },
+  { "file",            TOKEN_FILE },
+  { "stretch",                 TOKEN_STRETCH },
+  { "recolorable",     TOKEN_RECOLORABLE },
+  { "border",          TOKEN_BORDER },
+  { "detail",          TOKEN_DETAIL },
+  { "state",           TOKEN_STATE },
+  { "shadow",          TOKEN_SHADOW },
+  { "gap_side",        TOKEN_GAP_SIDE },
+  { "gap_file",        TOKEN_GAP_FILE },
+  { "gap_border",      TOKEN_GAP_BORDER },
+  { "gap_start_file",  TOKEN_GAP_START_FILE },
+  { "gap_start_border", TOKEN_GAP_START_BORDER },
+  { "gap_end_file",    TOKEN_GAP_END_FILE },
+  { "gap_end_border",  TOKEN_GAP_END_BORDER },
+  { "overlay_file",    TOKEN_OVERLAY_FILE },
+  { "overlay_border",  TOKEN_OVERLAY_BORDER },
+  { "overlay_stretch",         TOKEN_OVERLAY_STRETCH },
+  { "arrow_direction",         TOKEN_ARROW_DIRECTION },
+  { "orientation",     TOKEN_ORIENTATION },
+
+  { "HLINE",           TOKEN_D_HLINE },
+  { "VLINE",           TOKEN_D_VLINE },
+  { "SHADOW",          TOKEN_D_SHADOW },
+  { "POLYGON",         TOKEN_D_POLYGON },
+  { "ARROW",           TOKEN_D_ARROW },
+  { "DIAMOND",         TOKEN_D_DIAMOND },
+  { "OVAL",            TOKEN_D_OVAL },
+  { "STRING",          TOKEN_D_STRING },
+  { "BOX",             TOKEN_D_BOX },
+  { "FLAT_BOX",                TOKEN_D_FLAT_BOX },
+  { "CHECK",           TOKEN_D_CHECK },
+  { "OPTION",          TOKEN_D_OPTION },
+  { "CROSS",           TOKEN_D_CROSS },
+  { "RAMP",            TOKEN_D_RAMP },
+  { "TAB",             TOKEN_D_TAB },
+  { "SHADOW_GAP",      TOKEN_D_SHADOW_GAP },
+  { "BOX_GAP",         TOKEN_D_BOX_GAP },
+  { "EXTENSION",       TOKEN_D_EXTENSION },
+  { "FOCUS",           TOKEN_D_FOCUS },
+  { "SLIDER",          TOKEN_D_SLIDER },
+  { "ENTRY",           TOKEN_D_ENTRY },
+  { "HANDLE",          TOKEN_D_HANDLE },
+
+  { "TRUE",            TOKEN_TRUE },
+  { "FALSE",           TOKEN_FALSE },
+
+  { "TOP",             TOKEN_TOP },
+  { "UP",              TOKEN_UP },
+  { "BOTTOM",          TOKEN_BOTTOM },
+  { "DOWN",            TOKEN_DOWN },
+  { "LEFT",            TOKEN_LEFT },
+  { "RIGHT",           TOKEN_RIGHT },
+
+  { "NORMAL",          TOKEN_NORMAL },
+  { "ACTIVE",          TOKEN_ACTIVE },
+  { "PRELIGHT",                TOKEN_PRELIGHT },
+  { "SELECTED",                TOKEN_SELECTED },
+  { "INSENSITIVE",     TOKEN_INSENSITIVE },
+
+  { "NONE",            TOKEN_NONE },
+  { "IN",              TOKEN_IN },
+  { "OUT",             TOKEN_OUT },
+  { "ETCHED_IN",       TOKEN_ETCHED_IN },
+  { "ETCHED_OUT",      TOKEN_ETCHED_OUT },
+  { "HORIZONTAL",      TOKEN_HORIZONTAL },
+  { "VERTICAL",                TOKEN_VERTICAL },
+};
+
+static GtkRcStyleClass *parent_class;
+
+GType pixbuf_type_rc_style = 0;
+
+void
+pixbuf_rc_style_register_type (GtkThemeEngine *engine)
+{
+  static const GTypeInfo object_info =
+  {
+    sizeof (PixbufRcStyleClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) pixbuf_rc_style_class_init,
+    NULL,           /* class_finalize */
+    NULL,           /* class_data */
+    sizeof (PixbufRcStyle),
+    0,              /* n_preallocs */
+    (GInstanceInitFunc) pixbuf_rc_style_init,
+  };
+  
+  pixbuf_type_rc_style = gtk_theme_engine_register_type (engine,
+                                                        GTK_TYPE_RC_STYLE,
+                                                        "PixbufRcStyle",
+                                                        &object_info);
+}
+
+static void
+pixbuf_rc_style_init (PixbufRcStyle *style)
+{
+}
+
+static void
+pixbuf_rc_style_class_init (PixbufRcStyleClass *klass)
+{
+  GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  rc_style_class->parse = pixbuf_rc_style_parse;
+  rc_style_class->merge = pixbuf_rc_style_merge;
+  rc_style_class->create_style = pixbuf_rc_style_create_style;
+  
+  object_class->finalize = pixbuf_rc_style_finalize;
+}
+
+static void
+pixbuf_rc_style_finalize (GObject *object)
+{
+  PixbufRcStyle *rc_style = PIXBUF_RC_STYLE (object);
+  
+  g_list_foreach (rc_style->img_list, (GFunc) theme_image_unref, NULL);
+  g_list_free (rc_style->img_list);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static guint
+theme_parse_file(GScanner     *scanner,
+                ThemePixbuf **theme_pb)
+{
+  guint token;
+  gchar *pixmap;
+
+  /* Skip 'blah_file' */
+  token = g_scanner_get_next_token(scanner);
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_STRING)
+    return G_TOKEN_STRING;
+
+  if (!*theme_pb)
+    *theme_pb = theme_pixbuf_new ();
+
+  pixmap = gtk_rc_find_pixmap_in_path(scanner, scanner->value.v_string);
+  if (pixmap)
+    {
+      theme_pixbuf_set_filename (*theme_pb, pixmap);
+      g_free (pixmap);
+    }
+
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_border (GScanner     *scanner,
+                   ThemePixbuf **theme_pb)
+{
+  guint               token;
+  gint left, right, top, bottom;
+
+  /* Skip 'blah_border' */
+  token = g_scanner_get_next_token(scanner);
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_LEFT_CURLY)
+    return G_TOKEN_LEFT_CURLY;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_INT)
+    return G_TOKEN_INT;
+  left = scanner->value.v_int;
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_COMMA)
+    return G_TOKEN_COMMA;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_INT)
+    return G_TOKEN_INT;
+  right = scanner->value.v_int;
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_COMMA)
+    return G_TOKEN_COMMA;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_INT)
+    return G_TOKEN_INT;
+  top = scanner->value.v_int;
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_COMMA)
+    return G_TOKEN_COMMA;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_INT)
+    return G_TOKEN_INT;
+  bottom = scanner->value.v_int;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_RIGHT_CURLY)
+    return G_TOKEN_RIGHT_CURLY;
+
+  if (!*theme_pb)
+    *theme_pb = theme_pixbuf_new ();
+  
+  theme_pixbuf_set_border (*theme_pb, left, right, top, bottom);
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_stretch(GScanner     *scanner,
+                   ThemePixbuf **theme_pb)
+{
+  guint token;
+  gboolean stretch;
+
+  /* Skip 'blah_stretch' */
+  token = g_scanner_get_next_token(scanner);
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token == TOKEN_TRUE)
+    stretch = TRUE;
+  else if (token == TOKEN_FALSE)
+    stretch = FALSE;
+  else
+    return TOKEN_TRUE;
+
+  if (!*theme_pb)
+    *theme_pb = theme_pixbuf_new ();
+  
+  theme_pixbuf_set_stretch (*theme_pb, stretch);
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_recolorable(GScanner * scanner,
+                       ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_RECOLORABLE)
+    return TOKEN_RECOLORABLE;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token == TOKEN_TRUE)
+    data->recolorable = 1;
+  else if (token == TOKEN_FALSE)
+    data->recolorable = 0;
+  else
+    return TOKEN_TRUE;
+
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_function(GScanner * scanner,
+                    ThemeImage *data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_FUNCTION)
+    return TOKEN_FUNCTION;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if ((token >= TOKEN_D_HLINE) && (token <= TOKEN_D_HANDLE))
+    data->match_data.function = token;
+
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_detail(GScanner * scanner,
+                  ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_DETAIL)
+    return TOKEN_DETAIL;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_STRING)
+    return G_TOKEN_STRING;
+
+  if (data->match_data.detail)
+    g_free (data->match_data.detail);
+  
+  data->match_data.detail = g_strdup(scanner->value.v_string);
+
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_state(GScanner * scanner,
+                 ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_STATE)
+    return TOKEN_STATE;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token == TOKEN_NORMAL)
+    data->match_data.state = GTK_STATE_NORMAL;
+  else if (token == TOKEN_ACTIVE)
+    data->match_data.state = GTK_STATE_ACTIVE;
+  else if (token == TOKEN_PRELIGHT)
+    data->match_data.state = GTK_STATE_PRELIGHT;
+  else if (token == TOKEN_SELECTED)
+    data->match_data.state = GTK_STATE_SELECTED;
+  else if (token == TOKEN_INSENSITIVE)
+    data->match_data.state = GTK_STATE_INSENSITIVE;
+  else
+    return TOKEN_NORMAL;
+
+  data->match_data.flags |= THEME_MATCH_STATE;
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_shadow(GScanner * scanner,
+                  ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_SHADOW)
+    return TOKEN_SHADOW;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token == TOKEN_NONE)
+    data->match_data.shadow = GTK_SHADOW_NONE;
+  else if (token == TOKEN_IN)
+    data->match_data.shadow = GTK_SHADOW_IN;
+  else if (token == TOKEN_OUT)
+    data->match_data.shadow = GTK_SHADOW_OUT;
+  else if (token == TOKEN_ETCHED_IN)
+    data->match_data.shadow = GTK_SHADOW_ETCHED_IN;
+  else if (token == TOKEN_ETCHED_OUT)
+    data->match_data.shadow = GTK_SHADOW_ETCHED_OUT;
+  else
+    return TOKEN_NONE;
+
+  data->match_data.flags |= THEME_MATCH_SHADOW;
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_arrow_direction(GScanner * scanner,
+                           ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_ARROW_DIRECTION)
+    return TOKEN_ARROW_DIRECTION;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token == TOKEN_UP)
+    data->match_data.arrow_direction = GTK_ARROW_UP;
+  else if (token == TOKEN_DOWN)
+    data->match_data.arrow_direction = GTK_ARROW_DOWN;
+  else if (token == TOKEN_LEFT)
+    data->match_data.arrow_direction = GTK_ARROW_LEFT;
+  else if (token == TOKEN_RIGHT)
+    data->match_data.arrow_direction = GTK_ARROW_RIGHT;
+  else
+    return TOKEN_UP;
+
+  data->match_data.flags |= THEME_MATCH_ARROW_DIRECTION;
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_gap_side(GScanner * scanner,
+                    ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_GAP_SIDE)
+    return TOKEN_GAP_SIDE;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+
+  if (token == TOKEN_TOP)
+    data->match_data.gap_side = GTK_POS_TOP;
+  else if (token == TOKEN_BOTTOM)
+    data->match_data.gap_side = GTK_POS_BOTTOM;
+  else if (token == TOKEN_LEFT)
+    data->match_data.gap_side = GTK_POS_LEFT;
+  else if (token == TOKEN_RIGHT)
+    data->match_data.gap_side = GTK_POS_RIGHT;
+  else
+    return TOKEN_TOP;
+
+  data->match_data.flags |= THEME_MATCH_GAP_SIDE;
+  
+  return G_TOKEN_NONE;
+}
+
+static guint
+theme_parse_orientation(GScanner * scanner,
+                       ThemeImage * data)
+{
+  guint               token;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_ORIENTATION)
+    return TOKEN_ORIENTATION;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    return G_TOKEN_EQUAL_SIGN;
+
+  token = g_scanner_get_next_token(scanner);
+
+  if (token == TOKEN_HORIZONTAL)
+    data->match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
+  else if (token == TOKEN_VERTICAL)
+    data->match_data.orientation = GTK_ORIENTATION_VERTICAL;
+  else
+    return TOKEN_HORIZONTAL;
+
+  data->match_data.flags |= THEME_MATCH_ORIENTATION;
+  
+  return G_TOKEN_NONE;
+}
+
+static void
+theme_image_ref (ThemeImage *data)
+{
+  data->refcount++;
+}
+
+static void
+theme_image_unref (ThemeImage *data)
+{
+  data->refcount--;
+  if (data->refcount == 0)
+    {
+      if (data->match_data.detail)
+       g_free (data->match_data.detail);
+      if (data->background)
+       theme_pixbuf_destroy (data->background);
+      if (data->overlay)
+       theme_pixbuf_destroy (data->overlay);
+      if (data->gap_start)
+       theme_pixbuf_destroy (data->gap_start);
+      if (data->gap)
+       theme_pixbuf_destroy (data->gap);
+      if (data->gap_end)
+       theme_pixbuf_destroy (data->gap_end);
+      g_free (data);
+    }
+}
+
+static guint
+theme_parse_image(GScanner      *scanner,
+                 PixbufRcStyle *pixbuf_style,
+                 ThemeImage   **data_return)
+{
+  guint               token;
+  ThemeImage *data;
+
+  data = NULL;
+  token = g_scanner_get_next_token(scanner);
+  if (token != TOKEN_IMAGE)
+    return TOKEN_IMAGE;
+
+  token = g_scanner_get_next_token(scanner);
+  if (token != G_TOKEN_LEFT_CURLY)
+    return G_TOKEN_LEFT_CURLY;
+
+  data = g_malloc(sizeof(ThemeImage));
+
+  data->refcount = 1;
+
+  data->background = NULL;
+  data->overlay = NULL;
+  data->gap_start = NULL;
+  data->gap = NULL;
+  data->gap_end = NULL;
+
+  data->recolorable = FALSE;
+
+  data->match_data.function = 0;
+  data->match_data.detail = NULL;
+  data->match_data.flags = 0;
+
+  token = g_scanner_peek_next_token(scanner);
+  while (token != G_TOKEN_RIGHT_CURLY)
+    {
+      switch (token)
+       {
+       case TOKEN_FUNCTION:
+         token = theme_parse_function(scanner, data);
+         break;
+       case TOKEN_RECOLORABLE:
+         token = theme_parse_recolorable(scanner, data);
+         break;
+       case TOKEN_DETAIL:
+         token = theme_parse_detail(scanner, data);
+         break;
+       case TOKEN_STATE:
+         token = theme_parse_state(scanner, data);
+         break;
+       case TOKEN_SHADOW:
+         token = theme_parse_shadow(scanner, data);
+         break;
+       case TOKEN_GAP_SIDE:
+         token = theme_parse_gap_side(scanner, data);
+         break;
+       case TOKEN_ARROW_DIRECTION:
+         token = theme_parse_arrow_direction(scanner, data);
+         break;
+       case TOKEN_ORIENTATION:
+         token = theme_parse_orientation(scanner, data);
+         break;
+       case TOKEN_FILE:
+         token = theme_parse_file(scanner, &data->background);
+         break;
+       case TOKEN_BORDER:
+         token = theme_parse_border(scanner, &data->background);
+         break;
+       case TOKEN_STRETCH:
+         token = theme_parse_stretch(scanner, &data->background);
+         break;
+       case TOKEN_GAP_FILE:
+         token = theme_parse_file(scanner, &data->gap);
+         break;
+       case TOKEN_GAP_BORDER:
+         token = theme_parse_border(scanner, &data->gap);
+         break;
+       case TOKEN_GAP_START_FILE:
+         token = theme_parse_file(scanner, &data->gap_start);
+         break;
+       case TOKEN_GAP_START_BORDER:
+         token = theme_parse_border(scanner, &data->gap_start);
+         break;
+       case TOKEN_GAP_END_FILE:
+         token = theme_parse_file(scanner, &data->gap_end);
+         break;
+       case TOKEN_GAP_END_BORDER:
+         token = theme_parse_border(scanner, &data->gap_end);
+         break;
+       case TOKEN_OVERLAY_FILE:
+         token = theme_parse_file(scanner, &data->overlay);
+         break;
+       case TOKEN_OVERLAY_BORDER:
+         token = theme_parse_border(scanner, &data->overlay);
+         break;
+       case TOKEN_OVERLAY_STRETCH:
+         token = theme_parse_stretch(scanner, &data->overlay);
+         break;
+       default:
+         g_scanner_get_next_token(scanner);
+         token = G_TOKEN_RIGHT_CURLY;
+         break;
+       }
+      if (token != G_TOKEN_NONE)
+       {
+         /* error - cleanup for exit */
+         theme_image_unref (data);
+         *data_return = NULL;
+         return token;
+       }
+      token = g_scanner_peek_next_token(scanner);
+    }
+
+  token = g_scanner_get_next_token(scanner);
+
+  if (token != G_TOKEN_RIGHT_CURLY)
+    {
+      /* error - cleanup for exit */
+      theme_image_unref (data);
+      *data_return = NULL;
+      return G_TOKEN_RIGHT_CURLY;
+    }
+
+  /* everything is fine now - insert yer cruft */
+  *data_return = data;
+  return G_TOKEN_NONE;
+}
+
+static guint
+pixbuf_rc_style_parse (GtkRcStyle *rc_style,
+                      GScanner   *scanner)
+                    
+{
+  static GQuark scope_id = 0;
+  PixbufRcStyle *pixbuf_style = PIXBUF_RC_STYLE (rc_style);
+
+  guint old_scope;
+  guint token;
+  gint i;
+  ThemeImage *img;
+  
+  /* Set up a new scope in this scanner. */
+
+  if (!scope_id)
+    scope_id = g_quark_from_string("pixbuf_theme_engine");
+
+  /* If we bail out due to errors, we *don't* reset the scope, so the
+   * error messaging code can make sense of our tokens.
+   */
+  old_scope = g_scanner_set_scope(scanner, scope_id);
+
+  /* Now check if we already added our symbols to this scope
+   * (in some previous call to theme_parse_rc_style for the
+   * same scanner.
+   */
+
+  if (!g_scanner_lookup_symbol(scanner, theme_symbols[0].name))
+    {
+      g_scanner_freeze_symbol_table(scanner);
+      for (i = 0; i < G_N_ELEMENTS (theme_symbols); i++)
+       g_scanner_scope_add_symbol(scanner, scope_id,
+                                  theme_symbols[i].name,
+                                  GINT_TO_POINTER(theme_symbols[i].token));
+      g_scanner_thaw_symbol_table(scanner);
+    }
+
+  /* We're ready to go, now parse the top level */
+
+  token = g_scanner_peek_next_token(scanner);
+  while (token != G_TOKEN_RIGHT_CURLY)
+    {
+      switch (token)
+       {
+       case TOKEN_IMAGE:
+         img = NULL;
+         token = theme_parse_image(scanner, pixbuf_style, &img);
+         break;
+       default:
+         g_scanner_get_next_token(scanner);
+         token = G_TOKEN_RIGHT_CURLY;
+         break;
+       }
+
+      if (token != G_TOKEN_NONE)
+       return token;
+      else
+       pixbuf_style->img_list = g_list_append(pixbuf_style->img_list, img);
+
+      token = g_scanner_peek_next_token(scanner);
+    }
+
+  g_scanner_get_next_token(scanner);
+
+  g_scanner_set_scope(scanner, old_scope);
+
+  return G_TOKEN_NONE;
+}
+
+static void
+pixbuf_rc_style_merge (GtkRcStyle *dest,
+                      GtkRcStyle *src)
+{
+  if (PIXBUF_IS_RC_STYLE (src))
+    {
+      PixbufRcStyle *pixbuf_dest = PIXBUF_RC_STYLE (dest);
+      PixbufRcStyle *pixbuf_src = PIXBUF_RC_STYLE (src);
+      GList *tmp_list1, *tmp_list2;
+      
+      if (pixbuf_src->img_list)
+       {
+         /* Copy src image list and append to dest image list */
+         
+         tmp_list2 = g_list_last (pixbuf_dest->img_list);
+         tmp_list1 = pixbuf_src->img_list;
+         
+         while (tmp_list1)
+           {
+             if (tmp_list2)
+               {
+                 tmp_list2->next = g_list_alloc();
+                 tmp_list2->next->data = tmp_list1->data;
+                 tmp_list2->next->prev = tmp_list2;
+                 
+                 tmp_list2 = tmp_list2->next;
+               }
+             else
+               {
+                 pixbuf_dest->img_list = g_list_append (NULL, tmp_list1->data);
+                 tmp_list2 = pixbuf_dest->img_list;
+               }
+             
+             theme_image_ref (tmp_list1->data);
+             tmp_list1 = tmp_list1->next;
+           }
+       }
+    }
+
+  parent_class->merge (dest, src);
+}
+
+/* Create an empty style suitable to this RC style
+ */
+static GtkStyle *
+pixbuf_rc_style_create_style (GtkRcStyle *rc_style)
+{
+  return GTK_STYLE (g_object_new (PIXBUF_TYPE_STYLE, NULL));
+}
+
diff --git a/modules/engines/pixbuf/pixbuf-rc-style.h b/modules/engines/pixbuf/pixbuf-rc-style.h
new file mode 100644 (file)
index 0000000..3db0a3f
--- /dev/null
@@ -0,0 +1,49 @@
+/* GTK+ Pixbuf Engine
+ * Copyright (C) 1998-2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Written by Owen Taylor <otaylor@redhat.com>, based on code by
+ * Carsten Haitzler <raster@rasterman.com>
+ */
+
+#include <gtk/gtkrc.h>
+
+typedef struct _PixbufRcStyle PixbufRcStyle;
+typedef struct _PixbufRcStyleClass PixbufRcStyleClass;
+
+extern GType pixbuf_type_rc_style;
+
+#define PIXBUF_TYPE_RC_STYLE              pixbuf_type_rc_style
+#define PIXBUF_RC_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_RC_STYLE, PixbufRcStyle))
+#define PIXBUF_RC_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
+#define PIXBUF_IS_RC_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_RC_STYLE))
+#define PIXBUF_IS_RC_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_RC_STYLE))
+#define PIXBUF_RC_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
+
+struct _PixbufRcStyle
+{
+  GtkRcStyle parent_instance;
+  
+  GList *img_list;
+};
+
+struct _PixbufRcStyleClass
+{
+  GtkRcStyleClass parent_class;
+};
+
+void pixbuf_rc_style_register_type (GtkThemeEngine *engine);
diff --git a/modules/engines/pixbuf/pixbuf-style.h b/modules/engines/pixbuf/pixbuf-style.h
new file mode 100644 (file)
index 0000000..43bfc8b
--- /dev/null
@@ -0,0 +1,49 @@
+/* GTK+ Pixbuf Engine
+ * Copyright (C) 1998-2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Written by Owen Taylor <otaylor@redhat.com>, based on code by
+ * Carsten Haitzler <raster@rasterman.com>
+ */
+
+#include <gtk/gtkstyle.h>
+
+typedef struct _PixbufStyle PixbufStyle;
+typedef struct _PixbufStyleClass PixbufStyleClass;
+
+extern GType pixbuf_type_style;
+
+#define PIXBUF_TYPE_STYLE              pixbuf_type_style
+#define PIXBUF_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_STYLE, PixbufStyle))
+#define PIXBUF_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_STYLE, PixbufStyleClass))
+#define PIXBUF_IS_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_STYLE))
+#define PIXBUF_IS_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_STYLE))
+#define PIXBUF_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_STYLE, PixbufStyleClass))
+
+struct _PixbufStyle
+{
+  GtkStyle parent_instance;
+};
+
+struct _PixbufStyleClass
+{
+  GtkStyleClass parent_class;
+};
+
+void pixbuf_style_register_type (GtkThemeEngine *engine);
+
+
index b6e92030f45885f19bc2c603cbac36ee93b8d03f..9296a7def0101f8505595be5c84a1e5f2ab47974 100644 (file)
@@ -119,12 +119,6 @@ typedef enum {
   THEME_MATCH_ARROW_DIRECTION = 1 << 4
 } ThemeMatchFlags;
 
-struct _ThemeData
-{
-  guint refcount;
-  GList *img_list;
-};
-
 struct _ThemePixbuf
 {
   gchar     *filename;